#include<bits/stdc++.h>
using namespace std;

#define maxsize 100

typedef char elemtype;
typedef struct qnode
{
    elemtype data;
    struct qnode *next;
}qnode,*queueptr;

typedef struct 
{
    queueptr front,rear;
}linkqueue;

void initqueue(linkqueue *q)
{
    q->front =q->rear = (queueptr)malloc(sizeof(qnode));
    if(!q->front)
        exit(0);
    q->front->next = NULL;
}

void insertqueue(linkqueue *q,elemtype e)
{
    queueptr p;
    p =(queueptr)malloc(sizeof(qnode));
    p->data = e;
    p->next = NULL;
    q->rear->next = p;
    q->rear = p;
}

void deletequeue(linkqueue *q,elemtype *e)
{
    queueptr p;
    p = q->front->next;
    *e = p->data;
    q->front->next = p->next;
    if(q->rear = p)
        q->rear = q->front;
    free(p);
}

int main()
{
    elemtype e;
    elemtype arr[20];
    linkqueue q;
    initqueue(&q);
    for(int k = 0;k<20;k++)
    {
        scanf("%c",&arr[k]);
    }
    int i = 0;
    while(arr[i]!='#')
    {
        insertqueue(&q,arr[i]);
        i++;
    }
    for(int j = 0;j<20;j++)
    {
        deletequeue(&q,&e);
        printf("%c ",e);
    }
    return 0;
}
